package com.leaf.spring.y201907.day22.rabbitmq;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public class ConnectionUtil {
	
//	public static final String QUEUE_NAME = "testqueue";
	public static final String QUEUE_NAME = "order.create";
	public static final String EXCHANGE_NAME = "leafExchange";

	/**
	 * 获取rabbitMq连接
	 * 
	 * @return
	 * @throws TimeoutException 
	 * @throws IOException 
	 * @Description:
	 */
	public static Connection getConnection() throws IOException, TimeoutException {
		ConnectionFactory factory = new ConnectionFactory();
		factory.setHost("192.168.3.152");
		factory.setPort(5672);
		factory.setVirtualHost("testHost");
		factory.setUsername("leaf");
		factory.setPassword("123");
		return factory.newConnection();
	}

}
